import axios from 'axios'

// 配置基础 URL
const http = axios.create({
  baseURL: '/api/filmCollection', // 与后端接口路径一致
  timeout: 5000
})

// 获取用户收藏的电影列表
export const getFavouriteMovies = (userId) => http.get(`/collections/${userId}/movies`)

// 删除收藏的电影
export const deleteFavouriteMovie = (userId, movieId) => http.delete(`/collections/${userId}/${movieId}`)

// 添加收藏的电影
export const saveFavouriteMovie = (userId, movieId) => http.post(`/collections`, { userId, movieId })

// 判断电影是否已收藏
export const isFavourited = (userId, movieId) => http.get(`/check/${userId}/${movieId}`)
